package com.jyx.designpatterns.policy;

import java.util.Arrays;

//去掉一个最高分和一个最低分，然后计算剩下元素的代数平均值
public class StrategyThree implements ComputableStrategy {
	public double computeScore(double[] a) {
		if(a.length<=2)
			return 0;
		double score= 0,sum=0;
		Arrays.sort(a);
		for(int i=1; i<a.length-1; i++)
		{
			sum = sum + a[i];
		}
		score = sum/(a.length-2);
		return score;
	}
}